#ifndef PIN_H
#define	PIN_H

#include <p32xxxx.h>
#include <GenericTypeDefs.h>
#include <vector>
#include "Enumerations.h"

class Pin
{
public:
	// Default Constructor
	Pin();

	// Create a new Pin on the given port and number
	Pin(Enums::Gpio::Ports port, Enums::Gpio::Pins::Number number);

	// Create a new Pin on the given port and number with the given direction
	Pin(Enums::Gpio::Ports port, Enums::Gpio::Pins::Number number, Enums::Gpio::Pins::Direction direction);

	// Default Destructor
	virtual ~Pin();

	// Sets the port for the pin
	void SetPort(Enums::Gpio::Ports port);

	// Sets the direction for the pin
	void SetDirection(Enums::Gpio::Pins::Direction pinDirection);

	// Gets the direction of the pin
	Enums::Gpio::Pins::Direction GetDirection();

	// Sets the pin to a HIGH state
	void SetPin();

	// Clears the pin to a LOW state
	void ClearPin();

	// Toggles the state of the pin
	void TogglePin();

	// Gets the current value of the pin
	Enums::Gpio::Pins::Value GetPinValue();

	// Enables the Change Notification interrupt on the pin.
	void EnableChangeNotification(Enums::Gpio::Pins::PullUpState pullUpState, Enums::Interrupts::Priority priority, Enums::Interrupts::Subpriority subpriority, bool stopOnIdle);

	// Disables the Change Notification interrupt on the pin.
	void DisableChangeNotification();

private:
	// Pin port
	Enums::Gpio::Ports Port;

	// Pin number
	Enums::Gpio::Pins::Number Number;

	// Pin direction
	Enums::Gpio::Pins::Direction Direction;
};

#endif	/* PIN_H */